package lib.listen;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpServlet;
import java.text.SimpleDateFormat;//SimpleDateFormat是调整输出时间的格式
import java.util.Timer;
import java.util.TimerTask;

public class Listener  extends HttpServlet implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        Timer timer = new Timer();
        GetAccessToken myTask = new GetAccessToken();

        MonitorCouserNum monitorTask = new MonitorCouserNum();

        timer.schedule(myTask, 0, 1000*60*25);

        timer.schedule(monitorTask,0,1000*10);

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
